#include "shellSort2.h"
#include<stdio.h>
#include<stdlib.h>
#include<time.h>

void shellSort2( int * vet, int size, float* tempo ){  
     
     clock_t inicio, fim;
     inicio = clock();
     
         int i , j , value;
         int gap = 1;
         
         do {
            gap = 3*gap+1;
         } while ( gap < size );
	     do {
		    gap /= 3;
		    for ( i = gap; i < size; i++ ){
                
			    value =vet[i];
       			j = i - gap;
			    while ( j >= 0 && value < vet[j] ){
                        movimentarRegistro();
				      vet [j + gap] =vet[j];
				      j -= gap;
			    }
                movimentarRegistro();
			    vet [j + gap] = value;
		    }
	     } while ( gap > 1);
	     
     
     fim = clock();
     *tempo = ( (float)fim -(float)inicio ) / ( (float)CLOCKS_PER_SEC );
     printf("tempo shell2=%f\n", *tempo );  // PENDENTE
}

  
